<?php
class LimitedUsersModel extends AdvModel
{
    public function _switchConnect()
    {
        $this->addConnect(C('DSN_MALLS'), 2);
        $this->switchConnect(2);
    }

    /**
     * 进行验证码验证
     * @param string $verify 验证码
     * @return array
     * @author Ice <iceinto@mallog.com.cn>
     */
    public function checkVerify($verify)
    {
        $this->_switchConnect();
        $map = array();
        $map['verify'] = $verify;
        return $this->where($map)->find();
    }

    /**
     * 进行验证码验证
     * @param string $verify 验证码
     * @return array
     * @author Ice <iceinto@mallog.com.cn>
     */
    public function getReceiveUsersCount($lid)
    {
        $this->_switchConnect();
        $map = array();
        $map['lid'] = $lid;
        $map['status'] = 2; //已经领取的数量
        return $this->where($map)->count();
    }
}